WT_DECLARE_WT_MEMBER(1,JavaScriptConstructor,"WLineEdit",function(G,c,f,h,l,q,j,r){function s(a){return f.charAt(a)==="_"}function k(a){d.setSelectionRange(c,a,a+1)}function m(a){for(;s(a);)a++;k(a);return a}function w(a){for(;a>0&&s(a);)a--;k(a);return a}function x(a,b){if(b>=f.length)return false;switch(f.charAt(b)){case "a":case "A":return a>=t&&a<=y||a>=u&&a<=z;case "n":case "N":return a>=t&&a<=y||a>=u&&a<=z||a>=n&&a<=o;case "X":case "x":return true;case "0":case "9":return a>=n&&a<=o;case "d":case "D":return a>=
A&&a<=o;case "#":return a>=n&&a<=o||a===H||a===I;case "h":case "H":return a>=u&&a<=J||a>=n&&a<=o||a>=t&&a<=K;case "b":case "B":return a===n||a===A}return false}function p(a){var b=c.value.substring(0,a.start),e=c.value.substring(a.end),g=h.substring(a.start,a.end);c.value=b+g+e;d.setSelectionRange(c,a.start,a.start)}function v(a,b,e){var g=b=b;if(!e&&h.charAt(b)!==a&&!x(a.charCodeAt(0),b)&&b-1>=0&&h.charAt(b-1)===a)return b;for(;h.charAt(b)!==a&&!x(a.charCodeAt(0),b)&&b<f.length;)b++;if(b===f.length)return g;
e=c.value.substring(0,b);g=c.value.substring(b+1);if(h.charAt(b)!==a)if(q.charAt(b)===">")a=a.toUpperCase();else if(q.charAt(b)==="<")a=a.toLowerCase();c.value=e+a+g;b++;return b}function B(a){if(!(f===""||c.readOnly)){d.cancelEvent(a,d.CancelDefaultAction);var b=d.getSelectionRange(c);b.start!==b.end&&p(b);var e=undefined;if(window.clipboardData&&window.clipboardData.getData)e=window.clipboardData.getData("Text");else if(a.clipboardData&&a.clipboardData.getData)e=a.clipboardData.getData("text/plain");
else return;a="";var g=0;for(b=b.start;g<e.length;g++){a=e.charAt(g);b=v(a,b,true)}m(b)}}function C(a){if(!(f===""||c.readOnly)){d.cancelEvent(a,d.CancelDefaultAction);var b=d.getSelectionRange(c);if(b.start!==b.end){var e=c.value.substring(b.start,b.end);if(window.clipboardData&&window.clipboardData.setData)window.clipboardData.setData("Text",e);else a.clipboardData&&a.clipboardData.setData&&a.clipboardData.setData("text/plain",e);p(b)}}}function D(){if(!(f===""||c.readOnly))if(c.value===""){c.value=
h;m(0)}}var t="a".charCodeAt(0),K="f".charCodeAt(0),y="z".charCodeAt(0),u="A".charCodeAt(0),J="F".charCodeAt(0),z="Z".charCodeAt(0),H="-".charCodeAt(0),I="+".charCodeAt(0),n="0".charCodeAt(0),A="1".charCodeAt(0),o="9".charCodeAt(0);jQuery.data(c,"lobj",this);var M=this,d=G.WT,N=$(c);this.getValue=function(){if(f==="")return c.value;var a=c.value,b="",e="",g=0,i=0;for(g=0;g<a.length;g++){e=a.charAt(g);if(e!==j&&f.charAt(g)!=="_")i+=1;if(e!==j||f.charAt(g)==="_")b+=e}return i>0?b:""};this.setValue=
function(a){l=a;if(f==="")c.value=a;else if(!(r&1)&&!d.hasFocus(c))c.value=this.getValue();else{var b=d.getSelectionRange(c),e=-1;c.value=h;for(var g=0,i=0,E="";g<a.length;g++){E=a.charAt(g);if(b.start===b.end&&b.start===g)e=i;i=v(E,i,true)}if(d.hasFocus(c))if(e!==-1)k(e);else a.length==0&&k(0)}};this.setInputMask=function(a,b,e,g,i){f=a;h=b;q=g;j=i;this.setValue(e)};f!==""&&this.setInputMask(f,h,l,q,j);this.keyDown=function(a,b){if(!(f===""||c.readOnly))switch(b.keyCode){case 39:d.cancelEvent(b,
d.CancelDefaultAction);a=d.getSelectionRange(c);a.end-a.start<=1?m(a.start+1):d.setSelectionRange(c,a.end,a.end);break;case 37:d.cancelEvent(b,d.CancelDefaultAction);a=d.getSelectionRange(c);a.end-a.start<=1?w(a.start-1):d.setSelectionRange(c,a.start,a.start);break;case 36:d.cancelEvent(b,d.CancelDefaultAction);m(0);break;case 35:d.cancelEvent(b,d.CancelDefaultAction);d.setSelectionRange(c,f.length,f.length);break;case 46:d.cancelEvent(b,d.CancelDefaultAction);a=d.getSelectionRange(c);if(a.end-a.start<=
1){a=a.start;if(a<f.length&&!s(a)){b=c.value.substring(0,a);var e=c.value.substring(a+1);c.value=b+j+e;d.setSelectionRange(c,a,a)}}else p(a);break;case 8:d.cancelEvent(b,d.CancelDefaultAction);a=d.getSelectionRange(c);if(a.end-a.start<=1){a=a.start-1;if(a>=0){a=w(a);if(!s(a)){b=c.value.substring(0,a);e=c.value.substring(a+1);c.value=b+j+e;k(a)}}}else p(a);break}};this.keyPressed=function(a,b){if(!(f===""||c.readOnly)){a=b.charCode||b.keyCode;if(!(a===0||a===13||a===10)){d.cancelEvent(b,d.CancelDefaultAction);
b=d.getSelectionRange(c);b.start<b.end&&p(b);b=v(String.fromCharCode(a),b.start);m(b)}}};var F=this.getValue();this.focussed=function(){if(!(f===""||c.readOnly||r&1)){F=this.getValue();setTimeout(function(){M.setValue(l)},0)}};this.blurred=function(){if(!(f===""||c.readOnly||r&1)){l=c.value;c.value=this.getValue();c.value!==F&&N.change()}};this.clicked=function(){if(!(f===""||c.readOnly)){var a=d.getSelectionRange(c);a.start===a.end&&k(a.start)}};if(c.addEventListener)c.addEventListener("paste",B,
false);else c.attachEvent&&c.attachEvent("onpaste",B);if(c.addEventListener)c.addEventListener("cut",C,false);else c.attachEvent&&c.attachEvent("oncut",C);if(c.addEventListener)c.addEventListener("input",D,false);else c.attachEvent&&c.attachEvent("oninput",D);c.wtEncodeValue=function(){return f===""||r&1||d.hasFocus(c)?c.value:l}});
